/* 暗黑模式下的Markdown样式 */
[data-theme="dark"] .markdown-content {
  color: var(--text-primary);
  line-height: 1.6;
}

[data-theme="dark"] #documentDetailContentText {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] #documentDetailCategory {
  background-color: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}

[data-theme="dark"] .markdown-content h1,
[data-theme="dark"] .markdown-content h2,
[data-theme="dark"] .markdown-content h3,
[data-theme="dark"] .markdown-content h4,
[data-theme="dark"] .markdown-content h5,
[data-theme="dark"] .markdown-content h6 {
  color: var(--text-primary);
  border-bottom-color: var(--border);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.25;
}

[data-theme="dark"] .markdown-content h1 {
  font-size: 1.8rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

[data-theme="dark"] .markdown-content h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

[data-theme="dark"] .markdown-content h3 {
  font-size: 1.25rem;
}

[data-theme="dark"] .markdown-content p {
  margin-bottom: 1rem;
}

[data-theme="dark"] .markdown-content strong {
  font-weight: 600;
}

[data-theme="dark"] .markdown-content em {
  font-style: italic;
}

[data-theme="dark"] .markdown-content ul {
  list-style-type: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .markdown-content ol {
  list-style-type: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

[data-theme="dark"] .markdown-content li {
  margin-bottom: 0.25rem;
  list-style-position: outside;
}

/* 暗黑模式下的嵌套列表样式 */
[data-theme="dark"] .markdown-content ul ul {
  list-style-type: circle;
  padding-left: 1.5rem;
}

[data-theme="dark"] .markdown-content ul ul ul {
  list-style-type: square;
  padding-left: 1.5rem;
}

[data-theme="dark"] .markdown-content ol ol {
  list-style-type: lower-alpha;
  padding-left: 1.5rem;
}

[data-theme="dark"] .markdown-content ol ol ol {
  list-style-type: lower-roman;
  padding-left: 1.5rem;
}

[data-theme="dark"] .markdown-content ol ul,
[data-theme="dark"] .markdown-content ul ol {
  padding-left: 1.5rem;
}

[data-theme="dark"] .markdown-content a {
  color: var(--primary);
  text-decoration: none;
}

[data-theme="dark"] .markdown-content a:hover {
  text-decoration: underline;
}

[data-theme="dark"] .markdown-content code {
  font-family: monospace !important;
  background-color: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border-radius: 3px;
  padding: 0.2em 0.4em;
  font-size: 0.9em;
  box-sizing: border-box;
}

[data-theme="dark"] .markdown-content pre {
  font-family: monospace !important;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  box-sizing: border-box;
}

[data-theme="dark"] .markdown-content pre code {
  background-color: transparent;
  padding: 0;
  font-family: inherit !important;
}

[data-theme="dark"] .markdown-content blockquote {
  border-left: 4px solid var(--border);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

[data-theme="dark"] .markdown-content table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

[data-theme="dark"] .markdown-content th,
[data-theme="dark"] .markdown-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}

[data-theme="dark"] .markdown-content th {
  background-color: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

/* 暗黑模式下的Markdown预览样式 */
[data-theme="dark"] .markdown-preview {
  color: var(--text-secondary);
  line-height: 1.5;
}

[data-theme="dark"] .markdown-preview h1,
[data-theme="dark"] .markdown-preview h2,
[data-theme="dark"] .markdown-preview h3 {
  font-size: 1em;
  font-weight: 600;
  margin: 0.25em 0;
  border-bottom: none;
  display: inline;
}

[data-theme="dark"] .markdown-preview p {
  margin: 0.25em 0;
}

[data-theme="dark"] .markdown-preview ul,
[data-theme="dark"] .markdown-preview ol {
  padding-left: 1em;
  margin: 0.25em 0;
}

[data-theme="dark"] .markdown-preview li {
  margin-bottom: 0.1em;
}

[data-theme="dark"] .markdown-preview blockquote {
  border-left: 3px solid var(--border);
  padding-left: 0.5em;
  margin: 0.25em 0;
  font-size: 0.9em;
}

[data-theme="dark"] .markdown-preview code {
  font-family: monospace !important;
  background-color: rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
  border-radius: 3px;
  padding: 0.1em 0.3em;
  font-size: 0.9em;
}

/* 暗黑模式下的KaTeX公式样式 */
[data-theme="dark"] .katex-block {
  overflow-x: auto;
  margin: 1em 0;
  padding: 0.5em 0;
}

/* 确保公式在不同区域正确显示 */
[data-theme="dark"] .markdown-content .katex,
[data-theme="dark"] .markdown-preview .katex {
  font-size: 1.1em;
}

[data-theme="dark"] .markdown-content .katex-display,
[data-theme="dark"] .markdown-preview .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.5em 0;
}

/* 暗黑模式下的搜索结果框样式 */
[data-theme="dark"] #searchResults > div > div {
  border-color: var(--border) !important;
  background-color: var(--surface) !important;
  box-sizing: border-box;
}

/* 暗黑模式下的分类选择框样式 */
[data-theme="dark"] label.border.border-gray-200 {
  border-color: var(--border) !important;
  background-color: var(--surface) !important;
}

[data-theme="dark"] label.border.border-gray-200 input[type="checkbox"] {
  accent-color: var(--primary);
  border-color: var(--border) !important;
}

/* 暗黑模式下的文档内容水平线样式 */
[data-theme="dark"] .markdown-content hr {
  border-color: var(--border) !important;
  background-color: var(--border) !important;
}

/* 确保所有元素都使用一致的盒模型 */
[data-theme="dark"] * {
  box-sizing: border-box;
}

/* 暗黑模式下的文档详情页底部水平线样式 */
[data-theme="dark"] .flex.justify-end.pt-4.border-t.border-gray-200 {
  border-top-color: var(--border) !important;
}

/* 暗黑模式下的页脚边框样式 */
[data-theme="dark"] footer.border-t {
  border-top-color: var(--border) !important;
}